//
//  signBackMoneyCell.m
//  EMMApp
//
//  Created by 无常先生 on 2018/8/29.
//  Copyright © 2018年 YiXun. All rights reserved.
//

#import "signBackMoneyCell.h"
#import "signbackMoneyModel.h"

@interface signBackMoneyCell ()
@property (weak, nonatomic) IBOutlet UIView *containerView;
@property (weak, nonatomic) IBOutlet UILabel *bulidName;
@property (weak, nonatomic) IBOutlet UILabel *invalidDay;
@property (weak, nonatomic) IBOutlet UILabel *timeLable;
@property (weak, nonatomic) IBOutlet UILabel *userNmae;

@property (weak, nonatomic) IBOutlet UILabel *moenyLable;

@end

@implementation signBackMoneyCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundColor = [UIColor colorFromHexCode:@"#f8f8f8"];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.containerView.layer.cornerRadius = 4;
    [self.containerView setClipsToBounds:YES];
    self.containerView.layer.borderColor = [UIColor colorFromHexCode:@"#8e8e8e"].CGColor;
    self.containerView.layer.borderWidth = 0.5;


}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.invalidDay.layer.borderColor  = [UIColor colorFromHexCode:@"#880000"].CGColor;
    self.invalidDay.layer.borderWidth = 2.0;
    self.invalidDay.layer.cornerRadius = self.invalidDay.frame.size.height * 0.5;
    [self.invalidDay setClipsToBounds:YES];
}

- (void)desplayCell:(listModel *)model indexPath:(NSIndexPath *)indexPath {
    BOOL flag = indexPath.row % 2;
    self.containerView.backgroundColor = flag ? [UIColor colorFromHexCode:@"#61c0f0"] : [UIColor colorFromHexCode:@"#eb9192"];
    NSString *name = model.userName.length ? [NSString stringWithFormat:@"【%@】",model.userName] : @"";
    self.bulidName.text =  [NSString stringWithFormat:@"%@ %@", model.combinedName, name];
    self.userNmae.text = model.customerName;
    NSString *time = model.receivablesDate;
    if (time.length > 10) {
        time = [time substringToIndex:10];
    }
    self.timeLable.text = time;
    
    self.moenyLable.text = [NSString stringWithFormat:@"￥%@", model.uncollectedAmount];
    self.invalidDay.text = [NSString stringWithFormat:@"%@ 天", model.receivablesDay];
}

@end
